<template>
  <div class="container" v-title data-title="A借A还">
    <div class="suite">
      <div class="thumbImg">
        <img :src="require('../styles/asset/nine/activity.jpg')" />
      </div>
    </div>
  </div>
</template>

<script>
var wx = require('weixin-js-sdk');
  let filters = {
    parseURL:function(url) {
      let a = document.createElement('a');
      a.href = url;
      return {
        params: (function () {
          let ret = {},
            param = a.href.split('?')[1],
            seg = param.split('&'),
            len = seg.length,
            i = 0,
            s;
          for (; i < len; i++) {
            if (!seg[i]) {
              continue;
            }
            s = seg[i].split('=');
            ret[s[0]] = s[1];
          }
          return ret;
        })()
      }
    }
  };

  export default {
    data () {
      return {
        productId:'',
        token:"",
        state:true,
        postState:false,
        img: require('../styles/asset/share.jpg'),
        id:'',
        wx_app:''
      }
    },
    created () {

    },
    mounted(){
      const that = this;
      const url = window.location.href;
      this.id = filters.parseURL(url).params.id;
      if(url.indexOf('wx_app')>0){
        this.wx_app = filters.parseURL(url).params.wx_app;
        this.detail = filters.parseURL(url).params.detail;
        if(this.detail == 'true'){
          this.orderId = filters.parseURL(url).params.orderId;
        }
      }else{
        this.wx_app = ''
      }
      this.$util.getUserToken().then(token=>{
        that.token = token;
        that.getSuiteId();
      })
      let root = process.env.MAIN_ROOT;
      this.$util.sendShareMessage("六个轮子 | A借A还>>","六个轮子 | A借A还>>", root+this.img,url);
      if(url.indexOf('wx_app')>0){
        let newUrl = this.$util.wxUrl(url);
        // 小程序分享title，url
        wx.miniProgram.postMessage({
          data: {
            title: 'A借A还',
            wx_url: newUrl
          }
        })
      }
    },
    components: {
    },
    methods: {

    }
  }
</script>
<style scoped >
  @import "../styles/styles.css";
  .container{  width: 100%; height: 100%; }
  .suite{  margin: 0 auto; max-width: 750px; height: 100%; overflow-y: scroll; }
  .thumbImg>img{ width: 100%;}

</style>
